<!--
 * @Author: coman
 * @LastEditors: coman
 * @Date: 2020-06-09 18:01:47
 * @motto: No pain,No gain
 * @LastEditTime: 2020-06-09 18:47:57
--> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    输入月份<input type="text " id="month">
    <input type="button" onclick="day()" value="获取天数">
    <script>
       
        function day(){
            var month = document.getElementById("month").value;
            switch(month){
                case '1':case '3':case '5':case '7':case'8':case'10':case'12':
                    alert('天数为31天');
                    break;
                case '4':case '6':case '9':case '11':
                    alert('天数为30天');
                    break;
            }
        }
    </script>
</body>
</html>